/*     */ package nc.bs.pu.m20.maintain;
/*     */ 
/*     */ import java.io.Serializable;
/*     */ import java.util.ArrayList;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import nc.bs.pu.m20.maintain.rule.ATPAfterUpdateRule;
/*     */ import nc.bs.pu.m20.maintain.rule.ATPBeforeUpdateRule;
/*     */ import nc.bs.pu.m20.maintain.rule.ReturnBillCodeRule;
/*     */ import nc.bs.pu.m20.maintain.rule.delete.BillStatusRule;
/*     */ import nc.bs.pu.m20.maintain.rule.delete.CheckSrcRule;
/*     */ import nc.bs.pu.m20.maintain.rule.delete.DelOldVersionRule;
/*     */ import nc.bs.pu.m20.maintain.rule.delete.DeleteAfterEventRule;
/*     */ import nc.bs.pu.m20.maintain.rule.delete.DeleteBeforeEventRule;
import nc.bs.pu.m20.maintain.rule.delete.WriteDMOWhenDeleteRule;
import nc.bs.pu.m20.maintain.rule.delete.WriteE7WhenDeleteRule;
/*     */ import nc.bs.pu.m20.plugin.PraybillPluginPoint;
/*     */ import nc.bs.scmpub.rule.VOSagaFrozenValidateRule;
/*     */ import nc.impl.pubapp.pattern.data.bill.BillDelete;
/*     */ import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
/*     */ import nc.vo.pu.m20.entity.PraybillItemVO;
/*     */ import nc.vo.pu.m20.entity.PraybillVO;
/*     */ import nc.vo.pu.m20.enumeration.EnumOperate;
/*     */ import nc.vo.pu.pub.rule.WriteBack422xRule;
/*     */ import nc.vo.pu.pub.rule.WriteBackPIMRule;
/*     */ import nc.vo.pub.BusinessException;
/*     */ import nc.vo.pubapp.pattern.exception.ExceptionUtils;
/*     */ import nc.vo.scmpub.res.billtype.POBillType;
/*     */ import nccloud.commons.lang.ArrayUtils;
/*     */ import nccloud.pubitf.pu.pub.util.PuSagasUtil;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class PraybillDeleteBP
/*     */ {
/*     */   public void delete(PraybillVO[] vos) {
/*  63 */     CompareAroundProcesser<PraybillVO> processer = new CompareAroundProcesser<PraybillVO>(PraybillPluginPoint.DELETE);
/*     */     
/*  65 */     addBeforeRule(processer);
/*  66 */     addAfterRule(processer);
/*     */     
/*  68 */     processer.before(vos, vos);
/*     */     
/*  70 */     addSagaAndCompensate(vos);
/*  71 */     BillDelete<PraybillVO> bo = new BillDelete<PraybillVO>();
/*  72 */     bo.delete(vos);
/*     */     
/*  74 */     processer.after(vos, vos);
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   private void addAfterRule(CompareAroundProcesser<PraybillVO> processer) {
/*  80 */     processer.addAfterRule(new DelOldVersionRule());
/*     */ 
/*     */     
/*  83 */     processer.addAfterRule(new PraybillWriteBackSourceRule(EnumOperate.DELETE));
/*     */     
/*  85 */     processer.addAfterRule(new ATPAfterUpdateRule());
/*     */     
/*  87 */     processer.addAfterRule(new ReturnBillCodeRule());
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */     
/*  94 */     processer.addAfterRule(new WriteBackPIMRule(POBillType.PrayBill
/*  95 */           .getCode()));
/*     */ 
/*     */ 
/*     */ 
/*     */     
/* 100 */     processer.addAfterRule(new WriteBack422xRule(POBillType.PrayBill
/* 101 */           .getCode()));
/*     */ 
/*     */     
/* 104 */     processer.addAfterRule(new DeleteAfterEventRule());
               
            processer.addAfterRule(new WriteDMOWhenDeleteRule());
            processer.addAfterRule(new WriteE7WhenDeleteRule());

/*     */   }
/*     */ 
/*     */   
/*     */   private void addBeforeRule(CompareAroundProcesser<PraybillVO> processer) {
/* 109 */     processer.addBeforeRule(new VOSagaFrozenValidateRule(true));
/*     */     
/* 111 */     processer.addBeforeFinalRule(new BillStatusRule());
/*     */     
/* 113 */     processer.addBeforeFinalRule(new CheckSrcRule());
/*     */ 
/*     */     
/* 116 */     processer.addBeforeRule(new ATPBeforeUpdateRule());
/*     */     
/* 118 */     processer.addBeforeRule(new DeleteBeforeEventRule());
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private void addSagaAndCompensate(PraybillVO[] vos) {
/*     */     try {
/* 129 */       PuSagasUtil.frozenAndAddSaga(vos, POBillType.PrayBill.getCode());
/* 130 */       List<String> hList = new ArrayList<String>();
/* 131 */       List<String> bList = new ArrayList<String>();
/* 132 */       for (PraybillVO praybillVO : vos) {
/* 133 */         PraybillItemVO[] praybillItemVOs = praybillVO.getBVO();
/* 134 */         if (!ArrayUtils.isEmpty(praybillItemVOs)) {
/*     */ 
/*     */           
/* 137 */           hList.add(praybillVO.getHVO().getPk_praybill());
/* 138 */           for (PraybillItemVO praybillItemVO : praybillItemVOs)
/* 139 */             bList.add(praybillItemVO.getPk_praybill_b()); 
/*     */         } 
/*     */       } 
/* 142 */       Map<String, Serializable> map = new HashMap<String, Serializable>();
/* 143 */       map.put("opertaion", "praybillDelete");
/* 144 */       map.put("pk_praybill_b", bList
/* 145 */           .toArray(new String[bList.size()]));
/* 146 */       map.put("pk_praybill", hList
/* 147 */           .toArray(new String[hList.size()]));
/*     */       
/* 149 */       PuSagasUtil.compensate(nc.itf.pu.m20.compenstate.IBuyingreqM4A08SagasCompensate.class, map);
/* 150 */     } catch (BusinessException e) {
/* 151 */       ExceptionUtils.wrappException(e);
/*     */     } 
/*     */   }
/*     */ }


/* Location:              E:\zhuhai_ncc\NCC2111\modules\pu\META-INF\lib\pu_buyingreq.jar!/nc/bs/pu/m20/maintain/PraybillDeleteBP.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.0.7
 */